package NG::Gen::Task::BuyItem;
use strict;
use warnings;

use NG::Sys::App;

use NG::Sys::Datetime;
our @ISA = qw(NG::Gen::Task::Task);

sub before_done {
	my $self = shift;
	my $item = app()->reference("items")->get_by_key($self->param->{type});
	$self->{user}->add_item($self->{leader},$item,1);
	return 0;
}
sub before_assign {
	my $self = shift;
	my %avail = map {$_=>1} split /,/, $self->param->{types};
	unless($avail{$self->param->{type}}){
		return "Это не доступно";
	}
	return 0;
}

1;
